package com.exercise.core.util;/**
 * Created by kete on 2017-05-11.
 */

import java.math.BigDecimal;

/**
 * 作者：kete
 * 创建时间：2017-05-11 16:49
 * 功能描述：
 * 版本：
 */
public class ExecTime {
    private long start = System.currentTimeMillis();
    private long end;

    public ExecTime() {
    }

    public String toString() {
        this.end = System.currentTimeMillis();
        long all = this.end - this.start;
        BigDecimal d = new BigDecimal(all + "");
        return all < 1000L?all + " 毫秒":(all < 60000L?d.divide(new BigDecimal("1000"), 2, 5) + " 秒":d.divide(new BigDecimal("60"), 4, 5).divide(new BigDecimal("1000"), 2, 5) + " 分钟");
    }
}
